/******************************
Summary statistics

Panel B in Table 1: CTE enrollees
*******************************/
#delimit ;
set more off; 

include "./config.do" ;
cap log close; 
log using "./00.01.sumstats_cte.log", replace; 
use "$datadir/allearnings_cte_regressions.dta", clear; 

des;

/******************************************
Creating "before" and "after" enrolled
******************************************/

replace after_enrollment=0 if enrolled == 1 ;
gen totally_missing  = (earn_national == 0) ;
gen instate_missing = (earn_instate == 0 & earn_national != 0) ;

local summarystats earn_total earn_national earn_instate
                    logearn_total logearn_national logearn_state
                    male white black flag_se ;


gen all = 1 ;

foreach crossvar in all before_enrollment after_enrollment { ;

di "****************************" ;
di "CROSSVAR: `crossvar'" ;
di "****************************" ;                                                             
       summ `summarystats' if `crossvar' == 1 ;
       foreach tabvar in male white black flag_se { ;
                    qui count if `crossvar'== 1 & `tabvar'==1;
                    di "COUNT FOR `tabvar' and `crossvar':    " r(N) ;
       };
} ;                                                              

     foreach crossvar in all before_enrollment after_enrollment { ;
            di "****************************" ;
            di "CROSSVAR: `crossvar'" ;
            di "MISSING SHARES" ;                                                                   
            di "****************************" ;
            summ totally_missing instate_missing  if `crossvar' == 1 ;
            count if totally_missing ==1 & `crossvar' == 1 ;
            count if instate_missing == 1 & `crossvar'==1 ; 
     };

tab state if all == 1 ;

collapse (first) earn_national , by(pik );

count  ;


di " TOTAL COUNT OF UNIQUE PERSONS: " r(N) ;
